﻿@page "/"
@using System.ComponentModel.DataAnnotations;
@using System.Text.Json;
@using System.ComponentModel
@using AbpProjectTemplate.Application.Users.Dtos;
@using Microsoft.AspNetCore.Components.Forms;

<h1>Hello, world!</h1>
 
<Button Type="primary">Hello World!</Button>

<Form Model="@model"
      OnFinish="OnFinish"
      OnFinishFailed="OnFinishFailed"
      LabelColSpan="8"
      WrapperColSpan="16">
    <FormItem>
        <Input @bind-Value="@context.CurrentPassword" />
    </FormItem>
    <FormItem Label="Password">
        <InputPassword @bind-Value="@context.NewPassword" />
    </FormItem>
    <FormItem WrapperColOffset="8" WrapperColSpan="16">
        <Button Type="@ButtonType.Primary" HtmlType="submit">
            Submit 
        </Button>
    </FormItem>
</Form>

@code {
    private UserChangePasswordInput model = new UserChangePasswordInput();

    private void OnFinish(EditContext editContext)
    {
        Console.WriteLine($"Success:{JsonSerializer.Serialize(model)}");
    }

    private void OnFinishFailed(EditContext editContext)
    {
        Console.WriteLine($"Failed:{JsonSerializer.Serialize(model)}");
    }
}